package com.css.apps.base.sysjob.service;

import java.util.List;

import com.css.apps.base.sys.model.SSys;
import com.css.db.query.QueryCache;
import com.css.util.StringHelper;

public class SysJobService {
	
	@SuppressWarnings("unchecked")
	public static List<SSys> getSystems(){
		return QueryCache.idToObj(SSys.class, new QueryCache("select a.uuid from SSys a").listCache());
	}
	
	@SuppressWarnings("unchecked")
	public static List<SSys> getOpenSystems(){
		return QueryCache.idToObj(SSys.class, new QueryCache("select a.uuid from SSys a where a.openFlag='1' ").listCache());
	}
	
	public static SSys getSystem(String sysId){
		SSys sys = null;
		if(StringHelper.isEmpty(sysId))
			sys = new SSys();
		else
			sys = QueryCache.get(SSys.class, sysId); 
		return sys;
	}
	
	public static String getSystemName(String sysId){
		String sys = null;
		if(StringHelper.isEmpty(sysId))
			sys = null;
		else
			sys = QueryCache.get(SSys.class, sysId).getName(); 
		return sys;
	}
}